package com.inossem.warehousestorage_inossem.request.inStorage.chuangyou;

import android.content.Context;

import com.google.gson.Gson;
import com.inossem.warehousestorage_inossem.bean.inStorage.chuangyou.CYInStorageProductionListBean;
import com.inossem.warehousestorage_inossem.bean.inStorage.chuangyou.CYInStorageProductionListRequestBean;
import com.inossem.warehousestorage_inossem.bean.inStorage.chuangyou.CYInStorageShoppingListBean;
import com.inossem.warehousestorage_inossem.bean.inStorage.chuangyou.CYInStorageShoppingListRequestBean;
import com.inossem.warehousestorage_inossem.constant.RequestConstant;
import com.inossem.warehousestorage_inossem.listener.GsonBeanListener;
import com.inossem.warehousestorage_inossem.listener.StringRequestListener;
import com.inossem.warehousestorage_inossem.manage.RequestManage;
import com.inossem.warehousestorage_inossem.model.StringResponse;
import com.inossem.warehousestorage_inossem.request.Request;

/**
 * TODO
 *
 * @author 王斯宇
 * @time on 2018/4/3 15:18
 * @email siyu.wang@inossem.com
 */
public class CYInStorgaeProductionListRequest extends Request {
    public static String request(Context context, CYInStorageProductionListRequestBean bean, GsonBeanListener gsonBeanListener) {
        String tag;
//        Map<String, String> params = new HashMap<>();
//        params.put(CONDITION, TextUtils.isEmpty(condition) ? "" : condition);
        String url = RequestManage.getUrl(context, RequestConstant.CY_URL_IN_STORAGE_PRODUCTION_LIST );
        Gson gson = new Gson();
        String params = gson.toJson(bean, bean.getClass());
        tag = RequestManage.getHttpsPostWithLoading(context, url,params, new StringRequestListener() {
            @Override
            public void onSuccess(StringResponse stringRequestResponse) {
                Gson gson = new Gson();
                CYInStorageProductionListBean bean = gson.fromJson(stringRequestResponse.getResponseInfo(), CYInStorageProductionListBean.class);
                excuteJsonBeanNew(context, bean, gsonBeanListener);
            }
        });
        return tag;
    }
}
